-
Notifications
You must be signed in to change notification settings - Fork 594
HDDS-9426. Calculate Exclusive size for deep cleaned snapshot's deleted directories. #5579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
hemantk-12
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch @aswinshakil
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryService.java
Outdated
Show resolved
Hide resolved
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryService.java
Show resolved
Hide resolved
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryService.java
Outdated
Show resolved
Hide resolved
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryService.java
Outdated
Show resolved
Hide resolved
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryService.java
Outdated
Show resolved
Hide resolved
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryService.java
Outdated
Show resolved
Hide resolved
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryService.java
Outdated
Show resolved
Hide resolved
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryService.java
Outdated
Show resolved
Hide resolved
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryService.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/OMConfigKeys.java
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
Show resolved
Hide resolved
...anager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotPurgeRequest.java
Show resolved
Hide resolved
...anager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotPurgeRequest.java
Outdated
Show resolved
Hide resolved
...ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyDeletingService.java
Outdated
Show resolved
Hide resolved
...ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyDeletingService.java
Show resolved
Hide resolved
...nager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryCleaningService.java
Outdated
Show resolved
Hide resolved
...nager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryCleaningService.java
Outdated
Show resolved
Hide resolved
...nager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryCleaningService.java
Outdated
Show resolved
Hide resolved
...nager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryCleaningService.java
Show resolved
Hide resolved
...nager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryCleaningService.java
Outdated
Show resolved
Hide resolved
hemantk-12
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall changes look good to me. Left some minor and cosmetic comments.
We can merge this once you resolve them.
...nager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryCleaningService.java
Outdated
Show resolved
Hide resolved
...tion-test/src/test/java/org/apache/hadoop/ozone/om/TestSnapshotDirectoryCleaningService.java
Outdated
Show resolved
Hide resolved
...tion-test/src/test/java/org/apache/hadoop/ozone/om/TestSnapshotDirectoryCleaningService.java
Outdated
Show resolved
Hide resolved
...tion-test/src/test/java/org/apache/hadoop/ozone/om/TestSnapshotDirectoryCleaningService.java
Outdated
Show resolved
Hide resolved
...tion-test/src/test/java/org/apache/hadoop/ozone/om/TestSnapshotDirectoryCleaningService.java
Outdated
Show resolved
Hide resolved
| try { | ||
| count = cluster.getOzoneManager().getMetadataManager() | ||
| .countRowsInTable(table); | ||
| LOG.info("{} actual row count={}, expectedCount={}", table.getName(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This log statement is OK for debugging but not needed to be added.
...nager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryCleaningService.java
Show resolved
Hide resolved
hemantk-12
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating it @aswinshakil
LGTM except the seek and next as in comment: https://github.com/apache/ozone/pull/5579/files#r1413457354
...nager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryCleaningService.java
Outdated
Show resolved
Hide resolved
hemantk-12
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
swamirishi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aswinshakil Thanks for the patch. I have a few major review comments after going through the PR so far. I haven't gone through the entire code and logic yet. These are some of the review comments you can address in the meanwhile I review the rest of the PR.
...nager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryCleaningService.java
Outdated
Show resolved
Hide resolved
...nager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryCleaningService.java
Outdated
Show resolved
Hide resolved
...nager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryCleaningService.java
Outdated
Show resolved
Hide resolved
| } | ||
| } | ||
|
|
||
| if (directoryIterator.hasNext()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this loop into the else condition. In one iteration we will either delete files in the directory or process the sub directory. Let us not do both. Then we wouldn't be requiring the next.next in the else loop condition. It makes the logic complicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need the current directory reference to add the next sub-dir to the stack. So it is simpler to do it in the same iteration than the next iteration.
...nager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryCleaningService.java
Outdated
Show resolved
Hide resolved
...nager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryCleaningService.java
Outdated
Show resolved
Hide resolved
...nager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryCleaningService.java
Show resolved
Hide resolved
| // If the previous to previous snapshot doesn't | ||
| // have the key, then it is exclusive size for the | ||
| // previous snapshot. | ||
| if (keyInfoPrevToPrevSnapshot == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are supposed to look for the version diff, in case of object versioning. Exclusive size would be the size of the versions not found in the previous to previous and found in the previous snapshot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is the version size being checked?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One version of the object would correspond to only one snapshot we need to check which version this is. It could be the case the key was modified and we are deleting previous versions or we are keeping all object versions.
swamirishi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some suggestion. You may take it if it is helpful
...nager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDirectoryCleaningService.java
Outdated
Show resolved
Hide resolved
| stackTop.getDirValue().getObjectID(), ""); | ||
| stackTop.setSubDirSeek(seekDirInDB); | ||
| } else { | ||
| // Adding \0 to seek the next greater element. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hemantk-12 Can you confirm if adding "\0" is a correct approach. @aswinshakil it would be great to add this edge case in the unit test if it is not there. From what I know this should work since utf-8 encoding is orders strings lexicographically even in case of \0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me. As you said, we have to test it thoroughly.
swamirishi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aswinshakil thanks for the patch. I have raised a follow up jira for fixing the exclusive size calculation for buckets with object versioning enabled. https://issues.apache.org/jira/browse/HDDS-10051
|
Thank you @hemantk-12 and @swamirishi for the reviews! |
…'s deleted directories. (apache#5579)" This reverts commit d969689.
…'s deleted directories. (apache#5579)" (apache#6051) Reason for revert: incompatible proto changes This reverts commit 0528494. This reverts commit d969689.
…shot's deleted directories. (apache#5579) Change-Id: Ibea7794613f1702fb478fd70eeef7555255d697a
What changes were proposed in this pull request?
In #5339, We expanded the snapshot's
deletedDirTableintofileTableto calculate the exclusive size for the files under the deleted directories. The problem with that approach is that if we alter thefileTableanddirTableof a snapshot, it would change thesnapDiffresult and yield undesirable results. For eg, Consider a deleted directory structure as below,In the new approach in this patch, We do an in-memory walk for each deleted directory and deep clean them, and also calculate the
exclusive sizefor files when doing so. For each file, we do the same as #5301The reason we are doing a deep clean, There could be files under a directory trapped in between snapshots. Consider this case,
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-9426
How was this patch tested?
Added Integration test.